<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery.min.js"></script>
    <style>
        #table1{
            border:1px solid #2aabd2;
            width: 50%;
            background-color: lightcyan;
        }
        #table3{
            border:1px solid #2aabd2;
            width: 50%;
            background-color: lightcyan;
        }
        #table2{
            width: 100%;
        }
        #table2 tr:nth-child(odd){
            background-color: #eee;
        }
        #table2 tr:hover{
            background-color: #ccc;
        }
        #table2 tr td:first-child{
            color: #f40;
        }

        #table2 tr td{
            text-align: right;
            padding-right: 20px;
        }
    </style>
</head>
<body>
<form action="xitong_selectGroup.do">
    <table id="table1" border="1">
        <tr>
            <td colspan="5">用户组ID</td>
            <td><input type="text" id="groupID" name="groupID" th:value="${session.groupID}"></td>
        </tr>
        <tr>
            <td colspan="5">用户组名称</td>
            <td><input type="text" id="groupName" name="groupName" th:value="${session.groupName}"></td>
        </tr>
        <tr>
            <td colspan="5"><input type="submit" value="查询"></td>
            <td></td>
        </tr>
    </table>
    每页显示条数<select name="pageRows" id="pageRows" onchange="lastpage1(this.value)">
    <option th:each="i:${session.list}" th:text="${i}" th:value="${i}" th:selected="${session.pageRows == i}"></option>
</select>
    第<label th:text="${session.pageInfo.getPageNum()}"></label>页
    <input type="hidden" th:value="${session.pageInfo.getPageNum()}" id="pageNum">
</form>
<label th:if="${session.pageInfo.size==0}" style="color: #ff4400">没有查到任何数据!请核对查询信息</label>
<table id="table2" th:if="${session.pageInfo.size!=0}">
    <tr><td>用户组ID</td><td>组名称</td><td>编辑时间</td><td>是否删除</td><td>操作</td></tr>
    <tr th:each="everyGroup:${session.pageInfo.getList()}"><td th:text="${everyGroup.groupId}"></td><td th:text="${everyGroup.groupName}"></td><td th:text="${everyGroup.groupEditTime}"></td><td th:text="${everyGroup.groupIsDel eq 1?'是':'否'}"></td><td><button th:value="${everyGroup.groupId}" onclick="xuanze(this.value)">查看</button></td></tr>
    <tr><button th:value="${session.pageInfo.getPageNum()>1?session.pageInfo.getPageNum()-1:session.pageInfo.getPageNum()}" onclick="lastpage(this.value)">上一页</button>
        <button th:value="${session.pageInfo.getPageNum()<session.pageInfo.pages?session.pageInfo.getPageNum()+1:session.pageInfo.getPageNum()}" onclick="lastpage(this.value)">下一页</button></tr>
</table>
<table id="table3" th:if="${session.wmsTGroup!=null}">
    <tr><td>用户组名称</td><td><input th:value="${session.wmsTGroup.groupName}" disabled="disabled"></td></tr>
    <tr><td>权限名称</td><td><input th:value="${session.wmsTGroup.groupName}" disabled="disabled"></td></tr>
    <tr><td>备注</td><td><textarea  cols='30' rows='3' th:value="${session.wmsTGroup.groupNote}"></textarea></td></tr>
    <tr><td>最后编辑时间</td><td><input th:value="${session.wmsTGroup.groupEditTime}"></td></tr>
</table>
</body>
<script type="text/javascript">
    function lastpage(page) {
        var groupName = $("#groupName").val();
        var groupID = $("#groupID").val();
        var pagerows = $("#pageRows").val();
        window.location = "xitong_selectGroup.do?pageNum="+page+"&pageRows="+pagerows+"&groupName="+groupName+"&groupID="+groupID;
    }
    function lastpage1(row) {
        var groupName = $("#groupName").val();
        var groupID = $("#groupID").val();
        var pageNum = $("#pageNum").val();
        window.location = "xitong_selectGroup.do?pageNum="+pageNum+"&pageRows="+row+"&groupName="+groupName+"&groupID="+groupID;
    }
    function xuanze(groupId) {
        $.ajax({
            type:"get",
            url:"xitong_getOnegroup.do?groupId="+groupId,
            success:function (data) {
                window.location.reload();
            }
        })
    }
</script>
</html>